package org.esk.dablog.web.filters;

import org.esk.dablog.ApplicationConstants;

import javax.servlet.*;
import java.io.IOException;

/**
 * This class exposes application configuration properties to jsp pages
 * User: esk
 * Date: 22.12.2006
 * Time: 18:52:58
 * $Id:$
 */
public class ConfigurationFilter implements Filter {
    private static final String DEFAULT_CONFIGURATION_PROPERTY="__applicationConfig";


    public void init(FilterConfig filterConfig) throws ServletException {
    }


    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        servletRequest.setAttribute(DEFAULT_CONFIGURATION_PROPERTY, ApplicationConstants.getInstance());
        filterChain.doFilter(servletRequest, servletResponse);
    }

    public void destroy() {
    }
}
